package cm.cool.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import cm.cool.web.bean.Admin;
import cm.cool.web.service.AdminService;
import cm.cool.web.util.respon.PaginationDto;
import cm.cool.web.util.respon.R;


@RestController
@RequestMapping("/Admin")
public class AdminContrller {
	
	@Autowired
	private AdminService service;
	
	
	/**
	 * 添加一个管理
	 * @param admin
	 * @return
	 */
	@RequestMapping("/insert")
	public R insert(Admin admin){
		return service.insert(admin); 
	}
	
	/**
	 * 条件查找
	 * @param admin
	 * @param paginationDto
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/selectAll")
	public R selectAll(Admin admin,PaginationDto paginationDto){
		return service.selectAll(admin, paginationDto);
	}
	
	/**
	 * 删除一个管理
	 * @param id
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/deleteByPrimaryKey")
	public R deleteByPrimaryKey(String id){
		 return service.deleteByPrimaryKey(id);
	}
}
